import type { App } from 'vue';
import './assets/scss/index.scss';
import NdButton from './components/NdButton.vue';
import NdPopOver from './components/NdPopOver.vue';
import NdScrollContainer from './components/NdScrollContainer.vue';
import NdSvgIcon from './components/NdSvgIcon.vue';
import NdTextInput from './components/NdTextInput.vue';

// 导出所有组件
export {
	NdButton,
	NdPopOver,
	NdScrollContainer,
	NdSvgIcon,
	NdTextInput
};

// 定义组件列表
const components = [
	NdButton,
	NdPopOver,
	NdScrollContainer,
	NdSvgIcon,
	NdTextInput
];

// 定义 install 方法
const install = (app: App) => {
	components.forEach(component => {
		app.component(component.name || component.__name, component);
	});
};

// 导出 Vue 插件
export default {
	install
};

// 如果是直接通过 script 标签引入，自动安装
if (typeof window !== 'undefined' && window.Vue) {
	install(window.Vue);
}